from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field

class DetectionCreate(BaseModel):
    rotor_type_id: int = Field(..., description="旋翼类型ID")
    detection_type: int = Field(..., description="检测类型: 0-平稳性检测,1-俯仰检测,2-偏航检测,3-横滚检测")

class DetectionUpdate(BaseModel):
    id: int
    duration: Optional[int] = Field(None, description="检测时长(秒)")
    image_path: Optional[str] = Field(None, description="图片存储路径")
    video_path: Optional[str] = Field(None, description="视频存储路径")
    status: Optional[int] = Field(None, description="状态: 0-进行中,1-已完成")

class DetectionBase(BaseModel):
    id: int
    rotor_type_id: int
    detection_type: int
    operator_id: int
    detection_time: datetime
    duration: Optional[int]
    image_path: Optional[str]
    video_path: Optional[str]
    status: int
    created_at: datetime
    updated_at: datetime 